#include "ts_opt.h"
/********************* 触摸屏函数列表 *******************/

void wait4touch(void)
{
	int ts = open("/dev/event0", O_RDONLY);
	if(ts == -1)
	{
		perror("open() /dev/event0 failed");
		exit(0);
	}
	
	struct input_event buf;
	static int count = 0;
	while(1)
	{
		bzero(&buf, sizeof(buf));
		read(ts, &buf, sizeof(buf));

		if(buf.type == EV_ABS &&
		   buf.code == ABS_PRESSURE &&
		   buf.value == 0)
		{
			printf("clicked[%d]\n", ++count);
			break;
		}
	}
}